<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	template="template/test-materials.xhtml">

	<ui:define name="title">Administration | Edit Test</ui:define>
	<ui:define name="body">
		<h:outputStylesheet>
        .top {
        vertical-align: top;
        }
 
        .info {
        height: 202px;
        overflow: auto;
        }
    </h:outputStylesheet>

		<h1>Качване на материал</h1>

		<div id="upload">
			<h:form>
				<h:panelGrid columns="2" columnClasses="top,top">
					<rich:fileUpload fileUploadListener="#{fileUploadAction.listener}"
						id="upload" addLabel="Добави файл..." clearLabel="Изчисти" clearAllLabel="Изчисти всичко"
						uploadLabel="Качи" doneLabel="Качен" >
						<a4j:ajax event="uploadcomplete" execute="@none" render="info" />
					</rich:fileUpload>
					<h:panelGroup id="info">
						<rich:panel bodyClass="info">
							<f:facet name="header">
								<h:outputText style="height: 50px;" value="Статус на качен файл" />
							</f:facet>
							<h:outputText value="Към момента няма качени файлове"
								rendered="#{fileUploadAction.size==0}" />
							<rich:dataGrid columns="1" value="#{fileUploadAction.files}"
								var="file" rowKeyVar="row">
								<rich:panel bodyClass="rich-laguna-panel-no-header">
									<h:panelGrid columns="2">
										<h:outputText value="Наименование:" style="font-weight:bold"/>
										<h:outputText value="#{file.name}" />
										<h:outputText value="Размер(KB):" style="font-weight:bold"/>
										<h:outputText value="#{file.length}" />
										<h:commandLink value="Преглед" action="#{fileUploadAction.Download(file)}"/>
										<h:commandLink value="Изтрий" action="#{fileUploadAction.Remove(file)}" />
									</h:panelGrid>
								</rich:panel>
							</rich:dataGrid>
						</rich:panel>
						<br />
						<a4j:commandButton action="#{fileUploadAction.clearUploadData}"
							render="info, upload" value="Изтрии всички качени файлове"
							rendered="#{fileUploadAction.size>0}" />
					</h:panelGroup>
				</h:panelGrid>
			</h:form>
		</div>
	</ui:define>
</ui:composition>